import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router"
import Index from '@/views/index.vue'
import Detail from '@/views/detail.vue'
import Category from '@/views/category.vue'
// import Command from '@/views/command.vue'
import Plugin from '@/views/plugin.vue'
// import Create from "@/views/create.vue"
import Search from "@/views/search.vue"
import Home from '@/layout/home.vue'

const routes: RouteRecordRaw[] = [
    {
        path: '/', name: 'home', component: Home, meta: { keepAlive: true }, redirect: { name: 'index' }, children: [
            { path: '/index', name: 'index', component: Index, meta: { keepAlive: true } },
            { path: 'project/:id', name: 'detail', component: Detail, meta: { title: '项目详情', keepAlive: true } },
            { path: 'category', name: 'category', component: Category, meta: { title: '分类配置' } },
            // { path: 'command', name: 'command', component: Command, meta: { title: '命令管理' } },
            { path: 'plugin', name: 'plugin', component: Plugin, meta: { title: '插件管理' } },
            // { path: 'create/:category', name: 'create', component: Create },
        ]
    },

    { path: '/search', name: 'search', component: Search },
    { path: '/:pathMatch(.*)*', name: '404', component: Index },
]

const router = createRouter({
    history: createWebHistory(),
    routes,
})

export default router